package com.whl.sm.vo;

import com.whl.sm.model.notice.CommunityNotice;
import com.whl.sm.model.notice.UserCpNotice;
import com.whl.sm.model.system.OrgUserInfo;
import com.whl.sm.model.system.Role;
import com.whl.sm.model.system.UserCpRole;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
@NoArgsConstructor
public class UserCpNoticeVo implements Serializable {

    public UserCpNoticeVo(UserCpNotice userCpNotice, CommunityNotice communityNotice, OrgUserInfo orgUserInfo, Role role){
        if (Objects.nonNull(userCpNotice)){
            this.id = userCpNotice.getId();
            this.userId = userCpNotice.getUserId();
            this.noticeId = userCpNotice.getNoticeId();
            this.roleTypeId = userCpNotice.getRoleTypeId();
            this.readStatus = userCpNotice.getReadStatus();
            this.readTime = userCpNotice.getReadTime();
            this.createTime = userCpNotice.getCreateTime();
        }
        if (Objects.nonNull(communityNotice)){
            this.noticeTitle = communityNotice.getNoticeTitle();
            this.noticeContent = communityNotice.getNoticeContent();
        }
        if (Objects.nonNull(orgUserInfo)){
            this.userName = orgUserInfo.getUserName();
        }
        if (Objects.nonNull(role)){
            this.roleTypeName = role.getRoleName();
        }
    }


    /**
     * userCpNoticeId
     * */
    private String id;

    /**
     * 公告对象Id
     * */
    private String roleTypeId;

    /**
     * 公告对象名称
     * */
    private String roleTypeName;


    /**
     * 用户Id
     * */
    private String userId;

    /**
     * 用户名称
     * */
    private String userName;

    /**
     * 公告Id
     * */
    private String noticeId;

    /**
     * 公告标题
     * */
    private String noticeTitle;

    /**
     * 公告内容
     * */
    private String noticeContent;

    /**
     * 阅读状态
     * */
    private Integer readStatus;

    /**
     * 阅读时间
     * */
    private Date readTime;

    /**
     * 创建时间
     * */
    private Date createTime;


}
